#pragma once

#include "cocos2d.h"
#include "ResourceUnit.h"

class CAnimationUnit
{
public:
	CAnimationUnit(void);
	~CAnimationUnit(void);

	bool Init(CResourceUnit* resource, int group, int startframe, int endframe);
	void SetLoops(int times);
	void SetDelayPerUnit(float dt);
	void SetRestoreOriginalFrame(bool b);

	void Play();
	void Stop();

private:
	cocos2d::CCSprite*	m_pSprite;
	cocos2d::CCAnimation* m_pAnimation;
	cocos2d::CCAction* m_pAction;
	
	int m_group;
	int m_startFrame;
	int m_endFrame;
	int m_curFrame;
};

